package com.superme.filemanager.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.superme.common.beans.PageRequest;
import com.superme.common.beans.PageResponse;
import com.superme.common.enums.ExceptionCodeEnum;
import com.superme.common.exceptions.FileException;
import com.superme.filemanager.config.RequestUserInfo;
import com.superme.filemanager.mapper.PhotoUrlMapper;
import com.superme.filemanager.pojo.entity.PhotoUrl;
import com.superme.filemanager.service.PhotoUrlService;
import com.superme.filemanager.utils.MinioUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@Service
public class PhotoUrlServiceImpl implements PhotoUrlService {

    @Resource
    private PhotoUrlMapper photoUrlMapper;
    @Resource
    private MinioUtils minioUtils;
    @Resource
    private RequestUserInfo userInfo;



    @Override
    public PageResponse<PhotoUrl> getPage(PageRequest page) {
        LambdaQueryWrapper<PhotoUrl> wrapper = new LambdaQueryWrapper<>();
        wrapper.orderByDesc(PhotoUrl::getCreateTime);
        Page<PhotoUrl> photoUrlPage = photoUrlMapper.selectPage(new Page<>(page.getCurrentPage(), page.getPageSize()), wrapper);
        return new PageResponse<>(photoUrlPage);
    }


}
